python graph theory